package com.demo.ftp;


import java.io.File;
import java.util.Arrays;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {
        FtpProperty ftpProperty=new FtpProperty();
        //IP 地址 例如:168.61.1.1
        ftpProperty.setFtpHost("168.61.1.1");
        //编码格式
        ftpProperty.setFtpEncoding("utf-8");
        //FTP用户名
        ftpProperty.setFtpUserName("user");
        //FTP密码
        ftpProperty.setFtpPassword("password");
        //路径
        ftpProperty.setFtpPath("/path");
        //端口号
        ftpProperty.setFtpPort(21);
        //主动模式
        ftpProperty.setModel(FtpProperty.models.PASSIVE.value());
        //查询path目录下文件列表
        List<String> fileList = FtpUtils.ListFile(ftpProperty);
        //将test.xlsx文件从path目录下下载下拉 下载到D:\backup\下
        boolean flag = FtpUtils.downloadFtpFile(ftpProperty, Arrays.asList("test.xlsx"),Arrays.asList("D:\\backup\\"),0L);
        //将D:\backup\test.xlsx文件上传到path路径下并改名成a.xlsx
        FtpUtils.upload(ftpProperty,"a.xlsx","/path",new File("D:\\backup\\test.xlsx"));
    }

}
